package org.codefinger.json.parser.deserializer;

import org.codefinger.json.parser.JSONArrayDeserializer;
import org.codefinger.json.parser.JSONDeserializer;
import org.codefinger.json.parser.JSONLexer;
import org.codefinger.json.parser.JSONObjectDeserializer;
import org.codefinger.json.util.IdentityHashMap;

public class DeserializerForPojo implements JSONDeserializer {

	private static final IdentityHashMap<Class<?>, PojoDeserializer>	POJODESERIALIZER_MAP	= new IdentityHashMap<Class<?>, PojoDeserializer>();

	private PojoDeserializer											pojoDeserializer;

	public DeserializerForPojo(Class<?> pojoClass) {
		PojoDeserializer pojoDeserializer = POJODESERIALIZER_MAP.get(pojoClass);
		if (pojoDeserializer == null) {
			pojoDeserializer = new PojoDeserializer(pojoClass);
			POJODESERIALIZER_MAP.put(pojoClass, pojoDeserializer);
		}
		this.pojoDeserializer = pojoDeserializer;
	}

	@Override
	public Object stringValue(String value) {
		return null;
	}

	@Override
	public Object stringValue(JSONLexer jsonLexer) {
		jsonLexer.skipCurrentString();
		return null;
	}

	@Override
	public Object intValue(String value) {
		return null;
	}

	@Override
	public Object floatValue(String value) {
		return null;
	}

	@Override
	public Object falseValue() {
		return null;
	}

	@Override
	public Object trueValue() {
		return null;
	}

	@Override
	public JSONArrayDeserializer createArrayDeserializer() {
		return ArrayDeserializerForNull.INSTANCE;
	}

	@Override
	public JSONObjectDeserializer createObjectDeserializer() {
		return new ObjectDeserializerForPojo(pojoDeserializer);
	}

}
